<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="fp" uri="/fp-tags" %>

<%@ include file="/common/exterior/head.jsp"%>

<script type="text/javascript">

	$(document).ready(function() {
		$("#registerForm").validate({
			rules: {
				name:{
					required: true,
					minlength:2
				},
				qq:{
					required: true,
					digits:true
				},	
				email:{
					required:true,
					email:true
				},
				password:{
					required: true,
					minlength:6
				},
				passwordConfirm:{
					required: true,
					minlength:6,
					equalTo: "#password"
				}
		    },
		    messages:{
		    	name:{
	    			required:"用户名不能为空",
	    			minlength:"用户名最小长为2"
	   			},
				qq:{
		    		required:"QQ不能为空",
		    		digits:"必须是数字"
		   		},
		   		email:{
		   			required:"Email不能为空",
		   			emial:"请输入一个有数的Emial地址"
		   		},
		   		password:{
		   			required: "密码不能为空",
					minlength:"密码最小长为为6"
		   		},
		   		passwordConfirm:{
		   			required: "确认密码不能为空",
					minlength:"密码最小长为为6",
					equalTo:"二次输入的密码不一致"
		   		},
		    }
		});
	});

	function selfDefineQuestionMethod(thisObj){
		var value = thisObj.value;
		if(value=='selfDefineQuestionForPassword'){
			//var defaultQuestionElement = document.getElementById("defaultQuestion");
			//defaultQuestionElement.style.display="none";
			var selfElement = document.getElementById("selfTR");
			selfElement.style.display="";
		}
	}

</script>
<div class="content">  
  <div class="pageTitle">USER ACCOUNT REGIST</div>
  <script>menuSelected = "FUN003";</script>
  
  <div class="form1">
  
	<s:form id="registerForm" namespace="/account" action="register-account!save.action" method="post">
	<input type="hidden" name="id" value="${id}"/>
		<table align="center" class="noborder">
			<tr height="40px">
				<td>* &nbsp;邮箱:</td>
				<td><input type="text" name="email" size="40" id="email" value="${user.email}"/></td>
			</tr>
			<tr height="40px">
				<td>* &nbsp;密码:</td>
				<td><input type="password" id="password" name="password" size="40" value="${user.password}"/></td>
			</tr>
			<tr height="40px">
				<td>* &nbsp;确认密码:</td>
				<td><input type="password" id="passwordConfirm" name="passwordConfirm" size="40" value="${user.password}"/>
				</td>
			</tr>
			<tr height="40px">
				<td>* &nbsp;网名:</td>
				<td><input type="text" name="name" size="40" id="name" value="${user.name}"/></td>
			</tr>
			<tr height="40px">
				<td>* &nbsp;QQ:</td>
				<td><input type="text" name="qq" size="40" id="qq" value="${user.qq}"/></td>
			</tr>
			<tr height="40px" id="defaultQuestion">
				<td>* &nbsp;密保问题:</td>
				<td><s:select id="question" name="user.question" onchange="selfDefineQuestionMethod(this);" cssStyle="width:276px;" label="请选择" labelposition="top" list="#{
				'你的出生地是?':'你的出生地是?','您父亲的姓名是？':'您父亲的姓名是？','您母亲的姓名是？':'您母亲的姓名是？',
				'您身份证号码的最后6位是？':'您身份证号码的最后6位是？','selfDefineQuestionForPassword':'自定义问题'}" 
				listKey="key" listValue="value"/>
				</td>
			</tr>
			<tr id="selfTR" style="display:none;">
				<td>* &nbsp;密保问题:</td>
				<td><input type="text" id="selfDefineQuestion" name="selfDefineQuestion" size="40" value="${user.answer}"/></td>
			</tr>
			<tr height="40px">
				<td>* &nbsp;答案:</td>
				<td><input type="text" id="answer" name="answer" size="40" value="${user.answer}"/>
				</td>
			</tr>
			<tr height="40px">
				<td>手机号码:</td>
				<td><input type="text" id="phone" name="phone" size="40" value="${user.phone}"/></td>
			</tr>
		</table>
		
		 <div align="center">
	      		<div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <s:submit cssClass="inputButton" value="立即注册"></s:submit>
		            </div>
		          </div>
		        </div>
	     </div>
		
	     
	</s:form>
	</div>
</div>

<%@ include file="/common/foot.jsp"%>